/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package jee.forum.beans;

import java.util.List;
import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
import jee.forum.controller.ForumController;
import jee.forum.entities.Forum;
import org.apache.log4j.Logger;

/**
 *
 * @author Tobi
 */
@ManagedBean(name = "Index")
@RequestScoped
public class Index {

    @EJB
    private ForumController forumCtr;
    
    Logger log = Logger.getLogger(Index.class);
   

    public Index() {
    }


    public List<Forum> getForums() {

        try {
            return forumCtr.getForums();
        } catch (Exception e) {
            log.error("Error on getForums maybe IndexPage is not visible");
            return null; //TODO sollte noch angepasst werden, sonst gibts nur ne nullpointer
        }
    }
}
